package com.self.campussecondhandmarket.resp;

import lombok.Data;

import java.util.List;

/**
 * Author: Vincent
 * <p> DateTime: 2024/2/16 16:14
 * <p> Description: 分页结果封装
 * <p>
 **/
@Data
public class PageResult<T> {
	
	Long total;
	Integer code;
	String msg;
	List<T> data;
	
	public PageResult(Long total, Code code, List<T> data) {
		this.total = total;
		this.code = code.code();
		this.msg = code.msg();
		this.data = data;
	}
	
	public static <T> PageResult<T> success(Long total, List<T> data) {
		return new PageResult<>(total, Code.SUCCESS, data);
	}
	
}
